set an environmental variable when running valgrind to disable QRegularExpressions use of JIT which causes problems for valgrind. The release build of Qt 5.12.1 uses JIT by default. The debug build does not.
warn when running older version of valgrind that don't handle RDRAND instructions used by newer versions of Qt such as 5.12.1.
support multiple docker images in travis.
create a travis docker image with Qt 5.12.1.
compiler: gcc
env:
- BUILD_TYPE="docker"
+ - DOCKER_IMG="qtio"
- os: linux
dist: xenial
sudo: required
compiler: clang
env:
- BUILD_TYPE="docker"
+ - DOCKER_IMG="qtio"
+ - os: linux
+ dist: xenial
+ sudo: required
+ services: docker
+ compiler: gcc
+ env:
+ - BUILD_TYPE="docker"
+ - DOCKER_IMG=""
- os: linux
dist: xenial
sudo: required
compiler: gcc
env:
- BUILD_TYPE="local"
- - QT_VERSION="5.9.7" # 5.12.1 vtesto stmsdf fails differently on xenial & bionic
+ - QT_VERSION="5.9.7" # 5.12.1 vtesto stmsdf fails with valgrind 3.11.0 which is on xenial
addons:
apt:
packages:
script:
- if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "coverage" ]; then ./tools/travis_script_linux_coverage; fi
- - if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "docker" ]; then ./tools/travis_script_linux_docker; fi
+ - if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "docker" ]; then ./tools/travis_script_linux_docker ${DOCKER_IMG}; fi
- if [ "${TRAVIS_OS_NAME}" = "linux" ] && [ "${BUILD_TYPE}" = "local" ]; then echo $PATH; ./build_and_test; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ./tools/travis_script_osx; fi
expat \
libxml2-utils \
&& rm -rf /var/lib/apt/lists/*
+
# alternative compiler
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
&& rm -rf /var/lib/apt/lists/*
+
# pkgs needed to build document
RUN apt-get update && apt-get install -y --no-install-recommends \
fop \
docbook-xml \
docbook-xsl \
&& rm -rf /var/lib/apt/lists/*
+
# pkgs with libraries needed by gpsbabel
RUN apt-get update && apt-get install -y --no-install-recommends \
libusb-dev \
&& rm -rf /var/lib/apt/lists/*
+
# pkgs with qt used by gpsbabel
RUN apt-get update && apt-get install -y --no-install-recommends \
qt5-default \
qttools5-dev-tools \
qttranslations5-l10n \
&& rm -rf /var/lib/apt/lists/*
+
# pkgs needed to generate coverage report:
RUN apt-get update && apt-get install -y --no-install-recommends \
gcovr \
--- /dev/null
+# this file is used to build the image gpsbabel_build_environment used by travis.
+
+FROM ubuntu:bionic as qt_install
+WORKDIR /app
+
+# update environment.
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ apt-utils \
+ && apt-get upgrade -y \
+ && rm -rf /var/lib/apt/lists/*
+
+# install packages needed to install Qt
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ libdbus-1-3 \
+ libfreetype6 \
+ libfontconfig1 \
+ libx11-6 \
+ libx11-xcb1 \
+ ca-cacert \
+ wget \
+ && rm -rf /var/lib/apt/lists/*
+
+# basic build and test tools
+COPY ./qtci/install-qt ./qtci/extract-qt-installer /app/
+RUN QT_CI_PACKAGES=qt.qt5.5121.gcc_64,qt.qt5.5121.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=/app:${PATH} ./install-qt 5.12.1 /opt
+
+FROM ubuntu:bionic
+LABEL maintainer="https://github.com/tsteven4"
+WORKDIR /app
+
+# update environment.
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ apt-utils \
+ && apt-get upgrade -y \
+ && rm -rf /var/lib/apt/lists/*
+
+# install packages needed for gpsbabel build
+# split into multiple commands to limit layer size
+
+# basic build and test tools
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ g++ \
+ make \
+ autoconf \
+ gperf \
+ git \
+ valgrind \
+ expat \
+ libxml2-utils \
+ && rm -rf /var/lib/apt/lists/*
+
+# alternative compiler
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ clang \
+ && rm -rf /var/lib/apt/lists/*
+
+# pkgs needed to build document
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ fop \
+ xsltproc \
+ docbook-xml \
+ docbook-xsl \
+ && rm -rf /var/lib/apt/lists/*
+
+# pkgs with libraries needed by gpsbabel
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ libusb-dev \
+ && rm -rf /var/lib/apt/lists/*
+
+# dependencies of Qt
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ libglib2.0-0 \
+ libx11-xcb-dev \
+ libglu1-mesa-dev \
+ libasound2 \
+ libxcomposite1 \
+ libxcursor1 \
+ && rm -rf /var/lib/apt/lists/*
+
+# Qt
+COPY --from=qt_install /opt/qt-5.12.1.env /opt/qtio.env
+COPY --from=qt_install /opt/Qt/5.12.1 /opt/Qt/5.12.1
+COPY --from=qt_install /opt/Qt/Licenses /opt/Qt/Licenses
+
+# pkgs needed to generate coverage report:
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcovr \
+ openjdk-8-jre-headless \
+ && rm -rf /var/lib/apt/lists/*
+
+# install environment for locale test
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ locales \
+ && rm -rf /var/lib/apt/lists/* \
+ && sed -i 's/^# *\(en_US ISO-8859-1\)/\1/' /etc/locale.gen \
+ && locale-gen \
+ && locale -a
+
#!/bin/bash -ex
# you must be logged into docker for the push to succeed.
+
+versuffix=${1:+_$1} # tag name must be lower case
tag=$(date -u +%Y%m%dT%H%M%SZ)
-docker build --pull --tag gpsbabel_build_environment:latest .
-docker tag gpsbabel_build_environment:latest gpsbabel_build_environment:$tag
-docker tag gpsbabel_build_environment:latest tsteven4/gpsbabel_build_environment:latest
-docker tag gpsbabel_build_environment:latest tsteven4/gpsbabel_build_environment:$tag
-docker push tsteven4/gpsbabel_build_environment:$tag
-docker push tsteven4/gpsbabel_build_environment:latest
+docker build --pull --file Dockerfile${versuffix} --tag gpsbabel_build_environment${versuffix}:latest .
+docker tag gpsbabel_build_environment${versuffix}:latest gpsbabel_build_environment${versuffix}:$tag
+docker tag gpsbabel_build_environment${versuffix}:latest tsteven4/gpsbabel_build_environment${versuffix}:latest
+docker tag gpsbabel_build_environment${versuffix}:latest tsteven4/gpsbabel_build_environment${versuffix}:$tag
+docker push tsteven4/gpsbabel_build_environment${versuffix}:$tag
+docker push tsteven4/gpsbabel_build_environment${versuffix}:latest
docker image ls
# pass the compiler from the travis matrix through CC, CXX.
# we need the default charmap to be UTF-8 for test_encoding_utf8, explicit set it here through LC_ALL.
# travis has got the code to test in the pwd.
+
+ver=${1}
+versuffix=${ver:+_$1}
docker run \
--rm \
--mount type=bind,source="$(pwd)",target=/app \
--mount type=bind,source=/etc/passwd,target=/etc/passwd,readonly \
--mount type=bind,source=/etc/group,target=/etc/group,readonly \
--user "$(id -u):$(id -g)" \
-tsteven4/gpsbabel_build_environment \
-bash -c "./build_and_test"
+tsteven4/gpsbabel_build_environment${versuffix} \
+bash -c "if [ -n ${ver} ]; then if [ -e /opt/${ver}.env ]; then . /opt/${ver}.env; fi; fi; ./build_and_test"
# from time to time.
#
+vg_version_warning() {
+ echo "This version of valgrind may not be compatible with later versions of Qt." 1>&2
+ echo "If you get \"unhandled instruction bytes: 0xF 0xC7\" warnings from" 1>&2
+ echo "valgrind your valgrind is too old." 1>&2
+ echo "valgrind 3.13.0 and later should not have this problem." 1>&2
+ echo "$(which valgrind) is $(valgrind --version)" 1>&2
+ echo "" 1>&2
+}
+
QUIET="-q"
BASEPATH=`dirname $0`
+# Older valgrind can choke with newer version of Qt.
+# valgrind 3.11.0 has this problem with Qt 5.12.1.
+# It is unknown if 3.12.0 has this problem with Qt 5.12.1.
+# valgrind 3.13.0 does not have this problem with Qt 5.12.1.
+# valgrind 3.11.0 is find with Qt 5.9.7.
+# vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF2 0xB9 0x1 0x0 0x0 0x0
+vgmajor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 1)
+vgminor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 2)
+if [ ${vgmajor} -lt 3 ]; then
+ vg_vesion_warning
+fi
+if [ ${vgmajor} -eq 3 ] ; then
+ if [ ${vgminor} -le 12 ]; then
+ vg_version_warning
+ fi
+fi
+
+# newer versons of Qt, e.g. 5.12.x, use a JIT compiler for QRegularExpression.
+# JITs use of self-modifying code can confuse valgrind.
+# We disable JIT with this environmental variable to keep valgrind happy.
+# https://doc.qt.io/qt-5/qregularexpression.html#debugging-code-that-uses-qregularexpression
+export QT_ENABLE_REGEXP_JIT=0
+
while getopts "lj:" opt; do
case $opt in
l) OPTS="--leak-check=full --show-reachable=yes --num-callers=24 --suppressions=${BASEPATH}/gpsbabel.supp" ; QUIET="";;